//
//  NSNumber+Timestamp.m
//  WenXianEducation
//
//  Created by 任辰东 on 2018/3/27.
//  Copyright © 2018年 JSY. All rights reserved.
//

#import "NSNumber+Timestamp.h"

@implementation NSNumber (Timestamp)

- (NSString *)dateStringWithFormat:(NSString *)format
{
    NSTimeInterval timeInterval = (NSTimeInterval)(self.longLongValue);
    if (self.doubleValue > 100000000000) {
        //毫秒表示
        timeInterval = (NSTimeInterval)(self.doubleValue)/1000;
    }
    NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeInterval];
    
    NSDateFormatter* dateFormatter = [NSDateFormatter new];
    dateFormatter.dateFormat = format;
    return [dateFormatter stringFromDate:date];
}

@end
